;---------------------------------------------------------------------------
;Luigi Stand Summon (Entrance)
[Statedef 7000]
type    = A
movetype= I
physics = N
velset = (ParentDist X)/16,-3.33*const(size.yscale)
ctrl = 0
anim = 7000+50*(root,Var(6) <= 100)
sprpriority = 3

[State 7000, 1]
type = VelAdd
trigger1 = 1
y = .44*const(size.yscale)

[State 7000, 2]
type = ScreenBound
trigger1 = 1
value = 0

[State 7000, 3]
type = PlayerPush
trigger1 = 1
value = 0

[State 7000, 4]
type = Null
trigger1 = !Time
var(7) = -50-(50*(root,Var(0) > 0))

[State 7000, 5]
type = HitOverride
trigger1 = 1
attr = SCA,NA,SA,HA,NP,SP,HP
stateno = 7030
time = -1

[State 7000, 6]
type = HitBy
trigger1 = 1
value = SCA,NA,SA,HA,NP,SP,HP
time = -1

[State 7000, 7]
type = ParentVarSet
trigger1 = !Time && RoundState = 2
var(38) = 1

[State 7000, 8]
type = PlaySnd
trigger1 = !Time
value = S40,0

[State 7000, 9]
type = VarSet
trigger1 = 1
fvar(1) = P2BodyDist X 

[State 7000, 10]
type = VarSet
trigger1 = 1
fvar(2) = P2BodyDist Y 

[State 7000, 11]
type = ChangeState
trigger1 = Vel Y > 0 && Pos Y > -Vel Y
value = 7001
;---------------------------------------------------------------------------
;Luigi Stand Summon (Fireball Shot)
[Statedef 7001]
type    = S
movetype= A
physics = S
velset = 0,0
ctrl = 0
anim = 7001+50*(root,Var(6) <= 100)
sprpriority = 3

[State 7001, 1]
type = PosSet
trigger1 = !Time
y = 0

[State 7001, 2]
type = Helper
trigger1 = AnimElem = 4
name = "Green Fireball" 
ID = 7050
stateno = 7060
pos = ceil((-15+3*(Anim = 7051))*const(size.xscale)),ceil((-22+12*(Anim = 7051))*const(size.yscale))
postype = p1  
facing = 1
keyctrl = 0
size.xscale = const(size.xscale)
size.yscale = const(size.yscale)

[State 7001, 3]
type = ParentVarSet
trigger1 = AnimElem = 18
var(39) = 1

[State 7001, 4]
type = VarAdd
trigger1 = AnimElem = 18
var(11) = 1

[State 7001, 5]
type = PlaySnd
trigger1 = AnimElem = 4
value = S7000,0

[State 7001, 6]
type = PlaySnd
trigger1 = Time = 40
value = S1000,0
channel = 2

[State 7001, 7]
type = PlaySnd
trigger1 = Time = 48
value = S3000,0
channel = 3

[State 7001, 8]
type = HitOverride
trigger1 = 1
attr = SCA,NA,SA,HA,NP,SP,HP
stateno = 7030
time = -1

[State 7001, 9]
type = HitBy
trigger1 = 1
value = SCA,NA,SA,HA,NP,SP,HP
time = -1

[State 7001, 10]
type = VarSet
trigger1 = 1
fvar(1) = P2BodyDist X 

[State 7001, 11]
type = VarSet
trigger1 = 1
fvar(2) = P2BodyDist Y 

[State 7001, 12]
type = VarSet
trigger1 = 1
fvar(2) = P2BodyDist Y

[State 7001, 13]
type = VelSet
trigger1 = Anim = 7051 && AnimElem = 5
y = -3.6*const(size.yscale)

[State 7001, 14]
type = VelAdd
trigger1 = Anim = 7051 && Time >= 34
y = .44*const(size.yscale)

[State 7001, 15]
type = PlaySnd
trigger1 = Anim = 7051 && AnimElem = 5
value = S40,0

[State 7001, 16]
type = ChangeState
trigger1 = Anim = 7001 && !AnimTime
trigger2 = Anim = 7051 && Pos Y > -Vel Y && Time >= 34
value = 7020 
;---------------------------------------------------------------------------
;Luigi Stand Summon (Entrance)
[Statedef 7010]
type    = A
movetype= I
physics = N
velset = ifelse(parent,FrontEdgeDist > 50,(ParentDist X - 30)/15,(ParentDist X)/15),-3.33*const(size.yscale)
ctrl = 0
anim = 7000+50*(root,Var(6) <= 100)
sprpriority = 3

[State 7010, 1]
type = VelAdd
trigger1 = 1
y = .44*const(size.yscale)

[State 7010, 2]
type = ScreenBound
trigger1 = 1
value = 0

[State 7010, 3]
type = PlayerPush
trigger1 = 1
value = 0

[State 7010, 4]
type = Null
trigger1 = !Time
var(7) = -50-(50*(root,Var(0) > 0))

[State 7010, 5]
type = PlaySnd
trigger1 = !Time
value = S40,0

[State 7010, 6]
type = HitOverride
trigger1 = 1
attr = SCA,NA,SA,HA,NP,SP,HP
stateno = 7030
time = -1

[State 7010, 7]
type = HitBy
trigger1 = 1
value = SCA,NA,SA,HA,NP,SP,HP
time = -1

[State 7010, 8]
type = ParentVarSet
trigger1 = !Time && RoundState = 2
var(38) = 1

[State 7010, 9]
type = VarSet
trigger1 = 1
fvar(1) = P2BodyDist X 

[State 7010, 10]
type = VarSet
trigger1 = 1
fvar(2) = P2BodyDist Y 

[State 7010, 11]
type = ChangeState
trigger1 = Vel Y > 0 && Pos Y > -Vel Y
value = 7011
;---------------------------------------------------------------------------
;Luigi Crouch Summon (Jump)
[Statedef 7011]
type    = S
movetype= I
physics = N
velset = 0,0
ctrl = 0
anim = 7011+50*(root,Var(6) <= 100)
sprpriority = 3

[State 7011, 1]
type = PosSet
trigger1 = !Time
y = 0

[State 7011, 2]
type = VelSet
trigger1 = AnimElem = 3 
y = -9*const(size.yscale)

[State 7011, 3]
type = VelSet
trigger1 = AnimElemTime(3) >= 0
x = P2Dist X/((enemynear(0),Const(size.head.pos.y))*.2)*-1

[State 7011, 4]
type = VelSet
trigger1 = Vel X > (8*const(size.xscale))
x = (8*const(size.xscale))

[State 7011, 5]
type = VelSet
trigger1 = Vel X < 0
x = 0

[State 7011, 6]
type = StateTypeSet
trigger1 = AnimElem = 3
statetype = A
movetype = A

[State 7011, 7]
type = VelAdd
trigger1 = Time > 3
y = .44*const(size.yscale)

[State 7011, 8]
type = VarSet
trigger1 = !Time
fvar(3) = root,FVar(21)

[State 7011, 9]
type = HitDef
Trigger1 = !Time
attr = A, ST
animtype = Hard
guard.pausetime = 12,12
getpower = 0,0
givepower = 60, 30
guardflag = HA
hitflag = MAF
priority = 1, Miss
sparkno = -1
guardsound = S6, 0
ground.type = High
ground.slidetime = 0
ground.hittime  = 33
ground.velocity = 0
guard.hittime = 15
air.type = Low
fall = 1
fall.recover = 1
p1stateno = 7013
p2stateno = 7014

[State 7011, 10]
type = PlaySnd
trigger1 = AnimElem = 3
value = S40,0

[State 7011, 11]
type = HitOverride
trigger1 = 1
attr = SCA,NA,SA,HA,NP,SP,HP
stateno = 7030
time = -1

[State 7011, 12]
type = HitBy
trigger1 = 1
value = SCA,NA,SA,HA,NP,SP,HP
time = -1

[State 7000, 13]
type = VarSet
trigger1 = 1
fvar(1) = P2BodyDist X 

[State 7000, 14]
type = VarSet
trigger1 = 1
fvar(2) = P2BodyDist Y 

[State 7011, 15]
type = ChangeState
trigger1 = MoveGuarded
value = 7019

[State 7011, 16]
type = ChangeState
trigger1 = Vel Y > 0 && Pos Y > -Vel Y
value = 7012
;---------------------------------------------------------------------------
;Luigi Crouch Summon (Miss)
[Statedef 7012]
type    = S
movetype= I
physics = S
velset = 0,0
ctrl = 0
anim = 7012+50*(root,Var(6) <= 100)
sprpriority = 3

[State 7012, 1]
type = PosSet
trigger1 = !Time
y = 0

[State 7012, 2]
type = HitOverride
trigger1 = 1
attr = SCA,NA,SA,HA,NP,SP,HP
stateno = 7030
time = -1

[State 7012, 3]
type = HitBy
trigger1 = 1
value = SCA,NA,SA,HA,NP,SP,HP
time = -1

[State 7000, 8]
type = VarSet
trigger1 = 1
fvar(1) = P2BodyDist X 

[State 7000, 9]
type = VarSet
trigger1 = 1
fvar(2) = P2BodyDist Y 

[State 7012, 4]
type = ChangeState
trigger1 = !AnimTime
value = 7020 
;---------------------------------------------------------------------------
;Luigi Crouch Summon (Throw)
[Statedef 7013]
type    = A
movetype= A
physics = N
velset = 0,0
ctrl = 0
anim = 7013+50*(root,Var(6) <= 100)
sprpriority = 3

[State 7013, 1]
type = BindToTarget
trigger1 = !Time
pos = 0,0,Head

[State 7013, 2]
type = TargetBind
trigger1 = Time = 20
pos = 0,-16

[State 7013, 3]
type = TargetBind
trigger1 = Time = 30
pos = 0,ifelse(root,Var(6) <= 100,-20,-42)

[State 7013, 4]
type = TargetBind
trigger1 = Time = 35
pos = 0,ifelse(root,Var(6) <= 100,-28,-56)
time = 6

[State 7013, 5]
type = TargetBind
trigger1 = Time = 41
pos = -2,ifelse(root,Var(6) <= 100,-28,-56)
time = 6

[State 7013, 6]
type = TargetBind
trigger1 = Time = 47
pos = -4,ifelse(root,Var(6) <= 100,-28,-56)
time = 10

[State 7014, 7]
type = TargetLifeAdd
trigger1 = Time = 58
value = ceil(-40*FVar(3))

[State 7013, 8]
type = TargetVelSet
trigger1 = Time = 58
x = -3.8
y = 5.2

[State 7013, 9]
type = TargetState
trigger1 = !Time
value = 7014

[State 7013, 10]
type = VelAdd
trigger1 = (Pos Y < 0) && (Time > 35)
y = .44*const(size.yscale)

[State 7013, 11]
type = VelSet
trigger1 = (Time > 35) && (Vel Y > 0 && Pos Y >= -3)
y = 0

[State 7013, 12]
type = PosSet
trigger1 = (Time > 35) && (Vel Y >= 0 && Pos Y >= -3)
y = 0

[State 7013, 13]
type = PlaySnd
trigger1 = !Time 
value = S7010,0

[State 7013, 14]
type = PlaySnd
trigger1 = Time = 58
value = S7010,1

[State 7013, 15]
type = ParentVarAdd
trigger1 = !Time
var(2) = 1

[State 7013, 16]
type = Null
triggerall = !Time
trigger1 = root,Cond(FVar(20) > .3, FVar(20) := FVar(20) - .2,0) || root,Cond(FVar(21) > .3, FVar(21) := FVar(21) - .2,0)
persistent = 0

[State 7013, 17]
type = VarSet
trigger1 = 1
fvar(1) = P2BodyDist X 

[State 7013, 18]
type = VarSet
trigger1 = 1
fvar(2) = P2BodyDist Y 

[State 7013, 19]
type = ChangeState
trigger1 = !AnimTime
value = 7020
;---------------------------------------------------------------------------
;Luigi Crouch Summon (Throw)
[Statedef 7014]
type    = A
movetype= H
physics = N
ctrl = 0
sprpriority = 4

[State 7014, 1]
type = ChangeAnim2
trigger1 = !Time
value = 7014

[State 7014, 2]
type = VelAdd
trigger1 = Time >= 58
y = .44*const(size.yscale)

[State 7014, 3]
type = ChangeState
trigger1 = Vel Y > 0 && Pos Y > -Vel Y
value = 7015
;---------------------------------------------------------------------------
; HIT_BOUNCE (hit ground)
[Statedef 7015]
type    = A
movetype= H
physics = N

[State 7015, EnvShake]
type = FallEnvShake
trigger1 = Time = 0

[State 7015, 2]
type = ChangeAnim
triggerall = time = 0
trigger1 = (anim != [5051,5059]) && (anim != [5061,5069])
trigger2 = !SelfAnimExist(5100 + (anim % 10))
value = 5100

[State 7015, 3]
type = ChangeAnim
trigger1 = time = 0
trigger1 = (anim = [5051,5059]) || (anim = [5061,5069])
trigger1 = SelfAnimExist(5100 + (anim % 10))
value = 5100 + (anim % 10)

[State 7015, 4]
type = PosSet
trigger1 = Time = 0
y = 0

[State 7015, 5]
type = VelSet
trigger1 = Time = 0
y = 0

[State 7015, 10]
type = PlaySnd
trigger1 = Time = 1
value = F7, 2

[State 7015, 12]
type = ChangeState
trigger1 = AnimTime = 0
value = 7016
;---------------------------------------------------------------------------
; HIT_BOUNCE (bounce into air)
[Statedef 7016]
type    = A
movetype= H
physics = N
velset = -3.6, -7.6

[State 7016, 1] ;Coming hit ground anim (normal)
type = ChangeAnim
triggerall = time = 0
trigger1 = anim != [5101,5109]
trigger2 = !SelfAnimExist(5160 + (anim % 10))
value = 5160

[State 7016, 4]
type = PosSet
trigger1 = Time = 0
y = 20

[State 7016, 5] ;Acceleration
type = VelAdd
trigger1 = 1
y = .4

[State 7016, 6] ;Hit ground
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 12
type = ChangeState
value = 5810
;---------------------------------------------------------------------------
;Luigi Crouch Summon (Blocked)
[Statedef 7019]
type    = S
movetype= I
physics = N
ctrl = 0
sprpriority = 3

[State 7019, 1]
type = HitOverride
trigger1 = 1
attr = SCA,NA,SA,HA,NP,SP,HP
stateno = 7030
time = -1

[State 7019, 2]
type = HitBy
trigger1 = 1
value = SCA
time = -1

[State 7019, 3]
type = PlayerPush
trigger1 = 1
value = 0
ignorehitpause = 1

[State 7019, 4]
type = VelSet
trigger1 = !Time
x = .8*const(size.xscale)
y = -5*const(size.yscale)

[State 7019, 5]
type = VelAdd
trigger1 = 1
y = .44*const(size.yscale)

[State 7019, 6]
type = VarSet
trigger1 = 1
fvar(1) = P2BodyDist X 

[State 7019, 7]
type = VarSet
trigger1 = 1
fvar(2) = P2BodyDist Y 

[State 7019, 8]
type = ChangeState
trigger1 = Vel Y > 0 && Pos Y > -Vel Y
value = 7012
;---------------------------------------------------------------------------
;Luigi Leave
[Statedef 7020]
type    = S
movetype= I
physics = S
velset = 0,0
ctrl = 0
anim = 7020+(50*(root,Var(6) = 100 || (PrevStateNo = 7031)))
sprpriority = 3

[State 7020, 1]
type = ScreenBound
trigger1 = 1
value = 0

[State 7020, 2]
type = PlayerPush
trigger1 = 1
value = 0

[State 7020, 3]
type = StateTypeSet
trigger1 = AnimElem = 5
statetype = A       
physics = N      

[State 7020, 4]
type = VelSet
trigger1 = AnimElem = 5
x = -10*const(size.xscale)
y = -9.13*const(size.yscale)

[State 7020, 6]
type = PosSet
trigger1 = !Time
y = 0 

[State 7020, 7]
type = PlaySnd
trigger1 = AnimElem = 5
value = S40,0

[State 7020, 8]
type = ChangeState
trigger1 = BackEdgeDist < -30
value = 7300
;---------------------------------------------------------------------------
; HITA_UP (initial going up)
[Statedef 7030]
type    = A
movetype= H
physics = N
velset = -1.1*const(size.xscale),-7.6*const(size.yscale)
ctrl = 0
anim = 7030+(10*root,Var(6) = 100)
sprpriority = 3

[State 7031, 1]
type = PlaySnd
trigger1 = !Time
value = S7030,0

[State 7031, 2]
type = ParentVarAdd
trigger1 = !Time 
var(6) = -100
ignorehitpause = 1

[State 7031, 3]
type = VelAdd
trigger1 = 1
y = .44*const(size.yscale)

[State 7031, 4]
type = AssertSpecial
trigger1 = !(Time % 2)
flag = invisible

[State 7031, 5]
type = ChangeState
trigger1 = root,Var(6) = 100
value = 7031

[State 7031, 6]
type = ChangeState
trigger1 = root,Var(6) = 100
value = 7031

[State 7031, 7]
type = ChangeState
trigger1 = Vel Y > 0 && Pos Y > -Vel Y
value = 7020

[State 7031, 8]
type = ChangeState
trigger1 = root,Var(6) = 0
value = 7040
;---------------------------------------------------------------------------
; HITA_UP (initial going up)
[Statedef 7031]
type    = A
movetype= H
physics = N
velset = 0,0
ctrl = 0
anim = 7031
sprpriority = 3

[State 7031, 1]
type = PlaySnd
trigger1 = !Time
value = S4000,2

[State 7031, 2]
type = AssertSpecial
trigger1 = (GameTime % 2) = 0
flag = invisible

[State 7031, 3]
type = ChangeState
trigger1 = !AnimTime
value = 7020+(12*(Pos Y < 0))

[State 7031, 4]
type = ChangeState
trigger1 = root,Var(6) = 0
value = 7040
;---------------------------------------------------------------------------
; HITA_UP (initial going up)
[Statedef 7032]
type    = A
movetype= H
physics = N
velset = 0,0
ctrl = 0
anim = 7050
sprpriority = 3

[State 7032, 1]
type = NotHitBy
trigger1 = 1
value = SCA
time = 1

[State 7032, 2]
type = VelAdd
trigger1 = 1
y = .44

[State 7032, 4]
type = ChangeState
trigger1 = Vel Y > 0 && Pos Y > -Vel Y
value = 7020
;---------------------------------------------------------------------------
;Luigi Defeated
[Statedef 7040]
type    = L
movetype= H
physics = N
sprpriority = -3
velset = 0,0
anim = 7040
ctrl = 0
sprpriority = 3

[State 7040, 1]
type = VelSet
trigger1 = Time = 20
y = -8.72*const(size.yscale)

[State 7040, 2]
type = VelAdd
trigger1 = Time >= 20
y = .3488*const(size.yscale)

[State 7040, 3]
type = PlaySnd
trigger1 = Time = 0
value = S11,1
channel = 10

[State 7040, 4]
type = ChangeState
trigger1 = Pos Y > 100
value = 7300
;---------------------------------------------------------------------------
;Green Fireball (Intro)
[Statedef 7060]
type    = A
movetype= I
physics = N
velset = 0,0
ctrl = 0
anim = 7005
sprpriority = 4

[State 7060, 1]
type = BindToParent
trigger1 = Time = 1
time = 30
pos = -15+3*(parent,Anim = 7051),-22+12*(parent,Anim = 7051)

[State 7060, 2]
type = ChangeState
trigger1 = AnimTime = 0 
value = 7061

[State 7060, 3]
type = ChangeState
trigger1 = parent,MoveType = H 
value = 7063
;---------------------------------------------------------------------------
;Green Fireball (Shot)
[Statedef 7061]
type    = A
movetype= A
physics = N
velset = 2*const(size.xscale),0
ctrl = 0
anim = 7006
sprpriority = 4
hitcountpersist = 1
hitdefpersist = 1

[State 3001, 1]
type = VarAdd
trigger1 = !Time
var(0) = 1

[State 3001, 1]
type = VarAdd
trigger1 = 1
var(1) = 1

[State 3001, 3]
type = HitBy
trigger1 = 1
value = SCA,SP,HP
time = 1

[State 3001, 2]
type = HitOverride
trigger1 = 1
attr = SCA,SP,HP
stateno = IfElse(var(0) < 2, 7061,7062)
time = -1
ignorehitpause = 1

[State 7061, 1]
type = PosAdd
trigger1 = PrevStateNo = 7060 && !Time
x = 62+-24*(parent,Anim = 7051)
y = -13+9*(parent,Anim = 7051)

[State 7061, 2]
type = VelSet
trigger1 = 1
x = IfElse(Var(1) > 1 && Time < 2,1,2*const(size.xscale))
y = cos(Var(1)/12)

[State 7011, 8]
type = VarSet
trigger1 = !Time && PrevStateNo != 7061
fvar(3) = root,FVar(21)

[State 7061, 3]
type = HitDef
trigger1 = root,Var(5) < 10 && !Time
attr = S, SP
damage = ceil(50*Fvar(3)),13
animtype = Hard
guardflag = MA
hitflag = MAF
getpower = 0
priority = 3, Hit
pausetime = 4,12
sparkno = S6001
sparkxy = -9,0
hitsound = F5, 3
guardsound = 6, 0
ground.type = Low
ground.slidetime = 11
ground.hittime  = 22
ground.velocity = -8
ground.cornerpush.veloff = 0
air.type = Low
air.velocity = -5.4,-3
air.hittime = 100
id = 7000
chainID = -1
nochainID = -1
hitonce = 1
kill = 1
guard.kill = 1
fall.kill = 1
numhits = 1

[State 7061, 4]
type = Null
triggerall = NumTarget && MoveHit && HitPauseTime = 1 && HitCount = 1
trigger1 = root,Cond(FVar(20) > .3, FVar(20) := FVar(20) - .2,0) || root,Cond(FVar(21) > .3, FVar(21) := FVar(21) - .2,0)
ignorehitpause = 1
persistent = 0

[State 7061, 5]
type = VarSet
trigger1 = 1
fvar(1) = P2BodyDist X 

[State 7061, 6]
type = VarSet
trigger1 = 1
fvar(2) = P2BodyDist Y 

[State 7061, 7]
type = TargetState
triggerall = NumTarget && MoveHit
trigger1 = !(target,Time)
value = 5400
ignorehitpause = 1

[State 7061, 8]
type = ChangeState
trigger1 = MoveContact 
value = IfElse(var(0) < 2, 7061,7062)

[State 7061, 9]
type = ChangeState
trigger1 = root,var(47) = 150
value = 7062

[State 7061, 10]
type = ChangeState
trigger1 = FrontEdgeDist < -40
value = 7063
;---------------------------------------------------------------------------
;Green Fireball (Explode)
[Statedef 7062]
type    = A
movetype= A
physics = N
velset = 0,0
ctrl = 0
anim = 1
sprpriority = 4

[State 7062, 1]
type = VarAdd
trigger1 = !Time
var(1) = 1

[State 7062, 2]
type = VarSet
trigger1 = Time
var(1) = 0

[State 7062, 3]
type = Explod
trigger1 = !Time
anim = 7008 
ID = 7060 
pos = 0,0
postype = p1
facing = 1
vfacing = 1
removetime = -2
scale = const(size.xscale),const(size.yscale)
sprpriority = 4
ownpal = 1

[State 7063, 4]
type = ParentVarAdd
trigger1 = !Time
var(10) = 1

[State 7062, 5]
type = DestroySelf
triggerall = !NumExplod(7060) && Time
trigger1 = !NumTarget
trigger2 = NumTarget
trigger2 = target,StateType = L
;-------------------------------------------------------------------------
;Fireball Explod
[Statedef 7063]
type    = S
movetype= A
physics = N
anim = 1
ctrl = 0
velset = 0,0

[State 7063, 1]
type = ScreenBound
trigger1 = 1
value = 0

[State 7063, 2]
type = PlayerPush
trigger1 = 1
value = 0

[State 7063, 3]
type = ParentVarAdd
trigger1 = !Time
var(10) = 1

[State 7063, 4]
type = DestroySelf
triggerall = Time
trigger1 = !NumTarget && Anim = 1
trigger2 = NumTarget && Anim = 1
trigger2 = target,StateType = L
;---------------------------------------------------------------------------
;Kirby Stand Summon (Entrance)
[Statedef 7100]
type    = A
movetype= A
physics = N
velset = ifelse(parent,FrontEdgeDist > 50,(ParentDist X+20)/15,(ParentDist X)/15),-3.53*const(size.yscale)
ctrl = 0
anim = 7100
sprpriority = 3

[State 7100, 1]
type = VelAdd
trigger1 = 1
y = .44*const(size.yscale)

[State 7100, 2]
type = ScreenBound
trigger1 = 1
value = 0

[State 7100, 3]
type = PlayerPush
trigger1 = 1
value = 0

[State 7010, 4]
type = Null
trigger1 = !Time
var(7) = -100-(50*(root,Var(0) > 0))

[State 7100, 5]
type = PlaySnd
trigger1 = !Time
value = S7100,0

[State 7100, 6]
type = HitOverride
trigger1 = 1
attr = SCA,NA,SA,HA,NP,SP,HP
stateno = 7130
time = -1

[State 7100, 7]
type = HitBy
trigger1 = 1
value = SCA,NA,SA,HA,NP,SP,HP
time = -1

[State 7100, 8]
type = ParentVarSet
trigger1 = !Time && RoundState = 2
var(38) = 1

[State 7100, 9]
type = VarSet
trigger1 = 1
fvar(1) = P2BodyDist X 

[State 7100, 10]
type = VarSet
trigger1 = 1
fvar(2) = P2BodyDist Y 

[State 7100, 11]
type = ChangeState
trigger1 = Vel Y > 0 && Pos Y > -Vel Y
value = 7101
;---------------------------------------------------------------------------
;Kirby Stand Summon (Inhale)
[Statedef 7101]
type    = S
movetype= A
physics = S
velset = 0,0
ctrl = 0
anim = 7101
sprpriority = 3

[State 7101, 1]
type = PosSet
trigger1 = !Time
y = 0

[State 7101, 2]
type = VarSet
trigger1 = !Time
fvar(3) = root,FVar(21)

[State 7101,3]
type = HitDef
Trigger1 = root,var(5) < 10 && !Time
attr = S, NT
hitflag = M
priority = 1, Miss
sparkno = -1
p1sprpriority = 1
p1facing = 1
p2facing = 1
p1stateno = 7103
guard.dist = 0
fall = 1
numhits = 0
fall.recovertime = 1

[State 7101, 3]
type = HitOverride
trigger1 = 1
attr = SCA,NA,SA,HA,NP,SP,HP
stateno = 7130
time = -1

[State 7101, 4]
type = HitBy
trigger1 = 1
value = SCA,NA,SA,HA,NP,SP,HP
time = -1

[State 7101, 5]
type = PlaySnd
trigger1 = !Time
value = S7100,1

[State 7101, 6]
type = PlaySnd
trigger1 = AnimElem = 3
value = S7101,0
channel = 0

[State 7101, 7]
type = Explod
trigger1 = Time = 30 || Time = 47
anim = 7106
ID = 7100
pos = ceil(61*const(size.xscale)),ceil(-35*const(size.yscale))
postype = p1 
facing = 1
vfacing = 1
vel = -5.1*const(size.xscale),0
accel = 0,.52*const(size.yscale)
removetime = 10
scale = const(size.xscale),const(size.yscale)
sprpriority = 3
ownpal = 1
removeongethit = 1

[State 7101, 8]
type = Explod
trigger1 = Time = 35
anim = 7106
ID = 7104
pos = ceil(60*const(size.xscale)),ceil(-4*const(size.yscale))
postype = p1 
facing = 1
vfacing = 1
vel = -4.6*const(size.xscale),0
accel = 0,-.48*const(size.yscale)
removetime = 10
scale = const(size.xscale),const(size.yscale)
sprpriority = 3
ownpal = 1
removeongethit = 1

[State 7101, 9]
type = Explod
trigger1 = Time = 45 || Time = 50
anim = 7106
ID = 7105
pos = ceil(57*const(size.xscale)),ceil(-32*const(size.yscale))
postype = p1 
facing = 1
vfacing = 1
vel = -5*const(size.xscale),0
accel = 0,.14*const(size.yscale)
removetime = 10
scale = const(size.xscale),const(size.yscale)
sprpriority = 3
ownpal = 1
removeongethit = 1

[State 7101, 10]
type = VarSet
trigger1 = 1
fvar(1) = P2BodyDist X 

[State 7101, 11]
type = VarSet
trigger1 = 1
fvar(2) = P2BodyDist Y 

[State 7101, 12]
type = ChangeState
trigger1 = Time = 70
value = 7102
;---------------------------------------------------------------------------
;Kirby Stand Summon (Inhale Finish)
[Statedef 7102]
type    = S
movetype= A
physics = S
velset = 0,0
ctrl = 0
anim = 7102
sprpriority = 3

[State 7102, 1]
type = StopSnd
trigger1 = !Time
channel = 2

[State 7000, 8]
type = VarSet
trigger1 = 1
fvar(1) = P2BodyDist X 

[State 7000, 9]
type = VarSet
trigger1 = 1
fvar(2) = P2BodyDist Y 

[State 7102, 2]
type = ChangeState
trigger1 = Time = 20
value = 7120
;---------------------------------------------------------------------------
;Kirby Stand Summon (Inhale)
[Statedef 7103]
type    = S
movetype= A
physics = S
velset = 0,0
ctrl = 0
sprpriority = 3

[State 7103, 1]
type = TargetState
trigger1 = NumTarget && !Time
value = 7105

[State 7103, 1]
type = TargetFacing
triggerall = NumTarget && !Time
trigger1 = Facing = target,Facing
value = Facing * -1

[State 7103, 2]
type = NotHitBy
trigger1 = 1
value = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
time = 1

[State 7103, 3]
type = ParentVarAdd
trigger1 = !Time
var(2) = 1

[State 7103, 4]
type = ChangeState
trigger1 = NumTarget && (target,Pos X < Pos X + 30) && target,StateNo = 7105
value = 7104

[State 7103, 5]
type = ChangeState
trigger1 = !NumTarget || Time = 60
value = 7102
;---------------------------------------------------------------------------
;Kirby Stand Summon (Inhale)
[Statedef 7104]
type    = S
movetype= A
physics = S
anim = 7104
velset = 0,0
ctrl = 0
sprpriority = 3

[State 7104, 1]
type = TargetState
trigger1 = !Time
value = 7106

[State 7104, 2]
type = TargetLifeAdd
trigger1 = AnimElem = 10
value = ceil(-75*FVar(3))
kill = 1

[State 7104, 3]
type = HitAdd
trigger1 = AnimElem = 10
value = 1

[State 7104, 4]
type = TargetBind
trigger1 = AnimElem = 9
pos = 0,-14

[State 7104, 5]
type = TargetState
trigger1 = NumTarget && AnimElem = 10
value = 7107

[State 7104, 6]
type = Helper
trigger1 = NumTarget && AnimElem = 10
name = "Star"
ID = 7105
stateno = 7150
pos = 0,0
postype = p2
facing = 1
keyctrl = 0
ownpal = 0
supermovetime = 0
pausemovetime = 0
size.xscale = const(size.xscale)
size.yscale = const(size.yscale)

[State 7104, 7]
type = NotHitBy
trigger1 = 1
value = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
time = 1

[State 7104, 8]
type = Null
triggerall = !Time
trigger1 = root,Cond(FVar(20) > .3, FVar(20) := FVar(20) - .2,0) || root,Cond(FVar(21) > .3, FVar(21) := FVar(21) - .2,0)
ignorehitpause = 1
persistent = 0

[State 7104, 9]
type = PlaySnd
trigger1 = AnimElem = 2
value = S7101,1
channel = 0

[State 7104, 10]
type = PlaySnd
trigger1 = AnimElem = 10
value = S7101,2
channel = 0

[State 7104, 11]
type = ChangeState
trigger1 = !AnimTime
value = 7102

;---------------------------------------------------------------------------
;Sucked In
[Statedef 7105]
type    = A
movetype= H
physics = N
velset = 0,0
ctrl = 0
sprpriority = 3

[State 7105, 1]
type = ChangeAnim2
trigger1 = !Time
value = 5002

[State 7105, 2]
type = VelSet
trigger1 = !Time
x = 3

[State 7105, 3]
type = NotHitBy
trigger1 = 1
value = SCA
time = 1

[State 7105, 4]
type = PlayerPush
trigger1 = 1 
value = 0
;---------------------------------------------------------------------------
;Sucked In
[Statedef 7106]
type    = A
movetype= H
physics = N
velset = 0,0
ctrl = 0
sprpriority = 3

[State 7106, 1]
type = AssertSpecial
trigger1 = 1
flag = invisible

[State 7106, 2]
type = PlayerPush
trigger1 = 1 
value = 0

[State 7106, 3]
type = NotHitBy
trigger1 = 1
value = SCA,AA,AP,AT
time = 1
;---------------------------------------------------------------------------
;Sucked In
[Statedef 7107]
type    = A
movetype= H
physics = N
velset = -8.15,0
ctrl = 0
sprpriority = 3

[State 7106, 1]
type = AssertSpecial
trigger1 = 1
flag = invisible

[State 7106, 2]
type = PlayerPush
trigger1 = 1 
value = 0

[State 7106, 3]
type = ChangeState
trigger1 =  BackEdgeDist < 15 && Vel X != 0
value = 7108
;---------------------------------------------------------------------------
;Sucked In
[Statedef 7108]
type    = A
movetype= H
physics = N
velset = 2.1,-7.6
ctrl = 0
sprpriority = 3

[State 7108, 1]
type = ChangeAnim2
trigger1 = 1
value = 5002

[State 7108, 2]
type = PlayerPush
trigger1 = 1 
value = 0

[State 7108, 3]
type = VelAdd
trigger1 = 1
y = .44*const(size.yscale)

[State 7108, 4]
type = EnvShake
trigger1 = !Time
time = 15
freq = 60
ampl = -4
phase = 90

[State 7108, 5]
type = SelfState
trigger1 = Vel Y > 0 && Pos Y > -Vel Y
value = 5100

;---------------------------------------------------------------------------
;Kirby Crouch Summon (Entrance)
[Statedef 7110]
type    = A
movetype= I
physics = N
velset = ifelse(parent,FrontEdgeDist > 50,(ParentDist X+20)/15,(ParentDist X)/15),-3.83*const(size.yscale)
ctrl = 0
anim = 7100
sprpriority = 3

[State 7110, 1]
type = VelAdd
trigger1 = 1
y = .44*const(size.yscale)

[State 7110, 2]
type = ScreenBound
trigger1 = 1
value = 0

[State 7110, 3]
type = PlayerPush
trigger1 = 1
value = 0

[State 7110, 4]
type = Null
trigger1 = !Time
var(7) = -50-(50*(root,Var(0) > 0))

[State 7110, 5]
type = PlaySnd
trigger1 = !Time
value = S7100,0

[State 7110, 6]
type = HitOverride
trigger1 = 1
attr = SCA,NA,SA,HA,NP,SP,HP
stateno = 7130
time = -1

[State 7110, 7]
type = HitBy
trigger1 = 1
value = SCA,NA,SA,HA,NP,SP,HP
time = -1

[State 7110, 8]
type = ParentVarSet
trigger1 = !Time && RoundState = 2
var(38) = 1

[State 7110, 8]
type = VarSet
trigger1 = 1
fvar(1) = P2BodyDist X 

[State 7110, 9]
type = VarSet
trigger1 = 1
fvar(2) = P2BodyDist Y 

[State 7110, 10]
type = ChangeState
trigger1 = Vel Y > 0 && Pos Y > -Vel Y
value = 7111
;---------------------------------------------------------------------------
;Kirby Crouch Summon (Freeze)
[Statedef 7111]
type    = S
movetype= A
physics = N
velset = 0,0
ctrl = 0
anim = 7111
sprpriority = 3

[State 7101, 1]
type = PosSet
trigger1 = !Time
y = 0

[State 7101, 5]
type = PlaySnd
trigger1 = !Time
value = S7100,1

[State 7111, 1]
type = PlaySnd
trigger1 = AnimElem = 7
value = S7112,0

[State 7111, 2]
type = HitOverride
trigger1 = 1
attr = SCA,NA,SA,HA,NP,SP,HP
stateno = 7130
time = -1

[State 7111, 3]
type = HitBy
trigger1 = 1
value = SCA,NA,SA,HA,NP,SP,HP
time = -1

[State 7111, 4]
type = HitDef
triggerall = root,var(5) < 10 
trigger1 = !Time
attr = S, SA
damage = ceil(30*root,Fvar(21)),8
animtype = Hard
guardflag = MA
hitflag = MAF
getpower = 0,0
givepower = 25,13
priority = 6, Hit
pausetime = 1,1
sparkno = -1
hitsound = -1
guardsound = F6, 0
ground.slidetime = 30
guard.slidetime = 29
ground.hittime  = 70
guard.hittime = 30
ground.velocity = -6.4
ground.cornerpush.veloff = 0
air.type = High
air.velocity = -4.1,-3
air.hittime = 70
id = 7110
chainID = -1
nochainID = -1
hitonce = 0
kill = 1
guard.kill = 1
fall.kill = 1
numhits = 1

[State 7111, 5]
type = Null
trigger1 = NumTarget && MoveHit
trigger1 = root,Cond(FVar(20) > .3, FVar(20) := FVar(20) - .2,0) || root,Cond(FVar(21) > .3, FVar(21) := FVar(21) - .2,0)
ignorehitpause = 1
persistent = 0

[State 7111, 6]
type = TargetState
triggerall = NumTarget && MoveHit
trigger1 = HitPauseTime = 1
value = 5490;1013
ignorehitpause = 1

[State 7111, 7]
type = ParentVarAdd
triggerall = NumTarget && MoveHit
trigger1 = HitPauseTime = 1
var(2) = 1
ignorehitpause = 1

[State 7111, 8]
type = Explod
trigger1 = AnimElem = 7
anim = 7112
ID = 7112
pos = 0,0
postype = P1
facing = 1
vfacing = 1
bindtime = 1
removetime = -2
scale = const(size.xscale),const(size.yscale)
sprpriority = 5
ownpal = 1
removeongethit = 1

[State 7111, 9]
type = Explod
trigger1 = AnimElem = 7
anim = 7113
ID = 7113
pos = 0,0
postype = P1
facing = 1
vfacing = 1
bindtime = 1
removetime = -2
scale = const(size.xscale),const(size.yscale)
sprpriority = 4
ownpal = 1
removeongethit = 1

[State 7111, 10]
type = StateTypeSet
trigger1 = AnimElem = 21
movetype = I

[State 7111, 11]
type = VarSet
trigger1 = 1
fvar(1) = P2BodyDist X 

[State 7111, 12]
type = VarSet
trigger1 = 1
fvar(2) = P2BodyDist Y 

[State 7111, 13]
type = ChangeState
trigger1 = !AnimTime
value = 7120
;---------------------------------------------------------------------------
;Frozen
[Statedef 7112]
type    = U
movetype= H
physics = N
velset = 0,0
ctrl = 0
sprpriority = 3

[State 1013, 1]
type = ChangeAnim2
trigger1 = !Time
value = 5000

[State 1013, 2]
type = PalFX
trigger1 = Time < 50
time = 1
add = 0,80,256
mul = 0,256,256
sinadd = 0,0,0,1
invertall = 0
color = 256

[State 1013, 2]
type = PalFX
trigger1 = Time >= 50 && (GameTime % 2 = 0)
time = 1
add = 0,80,256
mul = 0,256,256
sinadd = 0,0,0,1
invertall = 0
color = 256

[State 1013, 3]
type = SelfState
triggerall = StateType != A && Pos Y >= 0
trigger1 = Time = 70
value = 0
ctrl = 1

[State 1013, 4]
type = SelfState
triggerall = Time = 70
trigger1 = StateType = A || Pos Y < 0
value = 5040
;---------------------------------------------------------------------------
;Kirby Leave
[Statedef 7120]
type    = S
movetype= I
physics = N
ctrl = 0
anim = 7120
sprpriority = 3

[State 7120, 1]
type = Turn
trigger1 = !Time

[State 7120, 2]
type = ScreenBound
trigger1 = 1
value = 0

[State 7120, 3]
type = PlayerPush
trigger1 = 1
value = 0

[State 7120, 4]
type = VelSet
trigger1 = !Time
x = 4.2*const(size.xscale)

[State 7120, 5]
type = Explod
trigger1 = !Time
anim = 7121
ID = 100
pos = ceil(-18*const(size.xscale)),ceil(-12*const(size.yscale))
postype = p1
ownpal = 1
sprpriority = 10
scale = const(size.xscale),const(size.yscale)

[State 7120, 6]
type = Explod
trigger1 = Time = 6
anim = 7121
ID = 100
pos = ceil(-18*const(size.xscale)),ceil(-12*const(size.yscale))
postype = p1
ownpal = 1
sprpriority = 10
scale = const(size.xscale),const(size.yscale)

[State 7120, 7]
type = PlaySnd
trigger1 = !Time
value = S7110,0

[State 7120, 8]
type = NotHitBy
trigger1 = 1
value = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
time = -1

[State 7120, 9]
type = ChangeState
trigger1 = FrontEdgeDist < -30
value = 7300
;---------------------------------------------------------------------------
; HITA_UP (initial going up)
[Statedef 7130]
type    = U
movetype= H
physics = N
ctrl = 0
anim = 7130
velset = -3*const(size.xscale),0
sprpriority = 3

[State 7130, 1]
type = VelAdd
trigger1 = StateType = A
y = .44*const(size.yscale)

[State 7130, 2]
type = ChangeState
trigger1 = (StateType = A) && (!AnimTime)
value = 7131

[State 7130, 3]
type = ParentVarAdd
trigger1 = !Time 
var(6) =  -100
ignorehitpause = 1

[State 7130, 4]
type = ChangeState
trigger1 = (StateType = S) && (!AnimTime)
trigger2 = (StateType = A) && (Vel Y > 0 && Pos Y > -Vel Y)
value = 7132

[State 7130, 5]
type = ChangeState
trigger1 = root,Var(6) = 0
value = 7140
;---------------------------------------------------------------------------
; HIT_LAND
[Statedef 7131]
type    = A
movetype= H
physics = N
ctrl = 0
anim = 7131

[State 7130, 1]
type = VelAdd
trigger1 = StateType = A
y = .44*const(size.yscale)

[State 7131, 2]
type = ChangeState
trigger1 = Vel Y > 0 && Pos Y > -Vel Y
value = 7132
;---------------------------------------------------------------------------
; HIT_LAND
[Statedef 7132]
type    = S
movetype= H
physics = N
velset = 0,0
ctrl = 0
anim = 7132

[State 7132, 1]
type = PosSet
trigger1 = !Time
y = 0

[State 7131, 2]
type = ChangeState
trigger1 = Time = 30
value = 7120
;---------------------------------------------------------------------------
; Kirby Dead
[Statedef 7140]
type    = A
movetype= H
physics = N
velset = 0,0
ctrl = 0
anim = 7140

[State 7040, 1]
type = VelSet
trigger1 = Time = 20
y = -8.72*const(size.yscale)

[State 7040, 2]
type = VelAdd
trigger1 = Time >= 20
y = .3488

[State 7040, 3]
type = Helper
trigger1 = (GameTime % 15) = 0
name = "Star"
ID = 7140
stateno = 7141+random%8
pos = 0,ceil(-16*const(size.yscale))
postype = p1   
ownpal = 1
size.xscale = const(size.xscale)
size.yscale = const(size.yscale)

[State 7040, 4]
type = PlaySnd
trigger1 = Time = 15
value = S7140,0

[State 7040, 5]
type = ChangeState
trigger1 = Pos Y > 100
value = 7300
;---------------------------------------------------------------------------
;Star Upleft
[Statedef 7141]
type    = A
physics = N
ctrl = 0
anim = 7141
velset = -6*const(size.xscale),-6*const(size.yscale)

[State 7141, PosSet]
type = PosAdd
trigger1 = !Time
x = -21*const(size.xscale)
y = -19*const(size.yscale)

[State 7141, VelSet]
type = VelSet
trigger1 = Time = 5
x = 0
y = 0

[State 7141, DestroySelf]
type = DestroySelf
trigger1 = Time = 15
;---------------------------------------------------------------------------
;Star Up
[Statedef 7142]
type    = A
physics = N
ctrl = 0
anim = 7141
velset = 0,-6*const(size.yscale)

[State 7142, PosSet]
type = PosAdd
trigger1 = !Time
y = -26*const(size.yscale)

[State 7142, VelSet]
type = VelSet
trigger1 = Time = 5
y = 0

[State 7142, DestroySelf]
type = DestroySelf
trigger1 = Time = 15
;---------------------------------------------------------------------------
;Star Upright
[Statedef 7143]
type    = A
physics = N
ctrl = 0
anim = 7141
velset = 6*const(size.xscale),-6*const(size.yscale)

[State 7143, PosSet]
type = PosAdd
trigger1 = !Time
x = 21*const(size.xscale)
y = -19*const(size.yscale)

[State 7143, VelSet]
type = VelSet
trigger1 = Time = 5
x = 0
y = 0

[State 7143, DestroySelf]
type = DestroySelf
trigger1 = Time = 15
;---------------------------------------------------------------------------
;Star Right
[Statedef 7144]
type    = A
physics = N
ctrl = 0
anim = 7141
velset = 6*const(size.xscale),0

[State 7144, PosSet]
type = PosAdd
trigger1 = !Time
x = 26*const(size.xscale)

[State 7144, VelSet]
type = VelSet
trigger1 = Time = 5
x = 0
y = 0

[State 7144, DestroySelf]
type = DestroySelf
trigger1 = Time = 15
;---------------------------------------------------------------------------
;Star Downright
[Statedef 7145]
type    = A
physics = N
ctrl = 0
anim = 7141
velset = 6*const(size.xscale),6*const(size.yscale)

[State 7145, PosSet]
type = PosAdd
trigger1 = !Time
x = 21*const(size.xscale)
y = 19*const(size.yscale)

[State 7145, VelSet]
type = VelSet
trigger1 = Time = 5
x = 0
y = 0

[State 7145, DestroySelf]
type = DestroySelf
trigger1 = Time = 15
;---------------------------------------------------------------------------
;Star Down
[Statedef 7146]
type    = A
physics = N
ctrl = 0
anim = 7141
velset = 0,6*const(size.yscale)

[State 7146, PosSet]
type = PosAdd
trigger1 = !Time
y = 26*const(size.yscale)

[State 7146, VelSet]
type = VelSet
trigger1 = Time = 5
y = 0

[State 7146, DestroySelf]
type = DestroySelf
trigger1 = Time = 15
;---------------------------------------------------------------------------
;Star Downleft
[Statedef 7147]
type    = A
physics = N
ctrl = 0
anim = 7141
velset = -6*const(size.xscale),6*const(size.yscale)

[State 7147, PosSet]
type = PosAdd
trigger1 = !Time
x = -21*const(size.xscale)
y = 19*const(size.yscale)

[State 7147, VelSet]
type = VelSet
trigger1 = Time = 5
x = 0
y = 0

[State 7147, DestroySelf]
type = DestroySelf
trigger1 = Time = 15
;---------------------------------------------------------------------------
;Star Left
[Statedef 7148]
type    = A
physics = N
ctrl = 0
anim = 7141
velset = -6*const(size.xscale),0

[State 7148, PosSet]
type = PosAdd
trigger1 = !Time
x = -26*const(size.xscale)

[State 7148, VelSet]
type = VelSet
trigger1 = Time = 5
x = 0
y = 0

[State 7148, DestroySelf]
type = DestroySelf
trigger1 = Time = 15
;---------------------------------------------------------------------------
;Star
[Statedef 7150]
type    = A
movetype= I
physics = N
velset = -8.15,0
anim = 7105
ctrl = 0
sprpriority = -3

[State 0, ChangeState]
type = ChangeState
trigger1 = BackEdgeDist < 15
value = 7151
;---------------------------------------------------------------------------
;Sucked In
[Statedef 7151]
type    = A
movetype= I
physics = N
velset = 0,0
ctrl = 0
sprpriority = -3

[State 7109, 1]
type = PlaySnd
trigger1 = !Time
value = S7112,1

[State 7109, 2]
type = DestroySelf
trigger1 = !Time
;---------------------------------------------------------------------------
;Link Stand Summon (Entrance)
[Statedef 7200]
type    = S
movetype= I
physics = N
velset = 5.04*const(size.xscale),0
ctrl = 0
anim = 7200
sprpriority = 3

[State 7200, 2]
type = ScreenBound
trigger1 = 1
value = 0

[State 7200, 3]
type = PlayerPush
trigger1 = 1
value = 0

[State 7200, 4]
type = Null
trigger1 = !Time
var(7) = -50-(50*(root,Var(0) > 0))

[State 7200, 5]
type = Helper
trigger1 = !Time
name = "Shield"
ID = 7205
stateno = 7205
pos = ceil(27*const(size.xscale)),0
postype = p1    
facing = 1
keyctrl = 0
ownpal = 0
supermovetime = 0
pausemovetime = 0
size.xscale = const(size.xscale)
size.yscale = const(size.yscale)

[State 7200, 6]
type = HitOverride
trigger1 = 1
attr = SCA,NA,SA,HA,NP,SP,HP
stateno = 7230
time = -1

[State 7200, 7]
type = HitBy
trigger1 = 1
value = SCA,NA,SA,HA,NP,SP,HP
time = -1

[State 7200, 8]
type = ParentVarSet
trigger1 = !Time && RoundState = 2
var(38) = 1

[State 7200, 9]
type = VarSet
trigger1 = 1
fvar(1) = P2BodyDist X 

[State 7200, 10]
type = VarSet
trigger1 = 1
fvar(2) = P2BodyDist Y 

[State 7200, 11]
type = PlaySnd
trigger1 = (AnimElem = 1 || AnimElem = 5) || !AnimTime
value = S7200,0

[State 7200, 12]
type = ChangeState
trigger1 = P2BodyDist X <= 35
value = 7201
;---------------------------------------------------------------------------
;Link Stand Summon (Attack)
[Statedef 7201]
type    = S
movetype= A
physics = N
ctrl = 0
anim = 7201
sprpriority = 3

[State 7201, 1]
type = VelAdd
trigger1 = Vel X > 1
x = -.25

[State 7201, 2]
type = VelSet
trigger1 = Vel X <= 1
x = 0

[State 7201, 3]
type = HitDef
trigger1 = root,var(5) < 10 && !Time
attr = S,NA
hitflag = MAF
guardflag = MA
animtype = Medium
priority = 4,Hit
damage = ceil(100*root,Fvar(21)),25
pausetime = 7,7
sparkno = S6001
guard.sparkno = -1
sparkxy = -9,-48*floor(const(size.yscale))
hitsound = S5,3
guardsound = S6,0
ground.type = High
ground.slidetime = 10
ground.hittime = 18
guard.hittime = 18
ground.velocity = -4.2*const(size.xscale)
air.type = High
air.hittime = 100
air.velocity = -2.9, -2
fall = 1
fall.recover = 0
id = 7201
chainID = -1
nochainID = -1
hitonce = 0
kill = 1
guard.kill = 1
fall.kill = 1
numhits = 1

[State 7201, 4]
type = Null
trigger1 = NumTarget && MoveHit
trigger1 = root,Cond(FVar(20) > .3, FVar(20) := FVar(20) - .2,0) || root,Cond(FVar(21) > .3, FVar(21) := FVar(21) - .2,0)
ignorehitpause = 1
persistent = 0

[State 7201, 5]
type = HitOverride
trigger1 = 1
attr = SCA,NA,SA,HA,NP,SP,HP
stateno = 7230
time = -1

[State 7201, 6]
type = HitBy
trigger1 = 1
value = SCA,NA,SA,HA,NP,SP,HP
time = -1

[State 7201, 7]
type = VarSet
trigger1 = 1
fvar(1) = P2BodyDist X 

[State 7201, 8]
type = VarSet
trigger1 = 1
fvar(2) = P2BodyDist Y 

[State 7201, 9]
type = PlaySnd
trigger1 = AnimElem = 4
value = S7200,1

[State 7201, 10]
type = ChangeState
trigger1 = Time = 50
value = 7220
;---------------------------------------------------------------------------
;Shield
[Statedef 7205]
type    = A
movetype= A
physics = N
velset = 0,0
ctrl = 0
anim = 7205
sprpriority = 3

[State 7205, 1]
type = BindToParent
trigger1 = 1
pos = 27,0

[State 7205, 2]
type = HitBy
trigger1 = 1
value = SCA,NP,SP
time = 1

[State 7205, 3]
type = HitOverride
trigger1 = 1
attr = SCA,NP,SP
stateno = 7205
time = 1

[State 0, DestroySelf]
type = DestroySelf
trigger1 = parent,StateNo != 7200
;---------------------------------------------------------------------------
;Link Crouch Summon (Entrance)
[Statedef 7210]
type    = A
movetype= I
physics = N
velset = ifelse(parent,FrontEdgeDist > 50,(ParentDist X+10)/15,(ParentDist X)/15),-3.83*const(size.yscale)
ctrl = 0
anim = 7210
sprpriority = 3

[State 7100, 1]
type = VelAdd
trigger1 = 1
y = .44*const(size.yscale)

[State 7100, 2]
type = ScreenBound
trigger1 = 1
value = 0

[State 7100, 3]
type = PlayerPush
trigger1 = 1
value = 0

[State 7010, 4]
type = Null
trigger1 = !Time
var(7) = -50-(50*(root,Var(0) > 0))

[State 7100, 5]
type = PlaySnd
trigger1 = !Time
value = S7210,0

[State 7100, 6]
type = HitOverride
trigger1 = 1
attr = SCA,NA,SA,HA,NP,SP,HP
stateno = 7230
time = -1

[State 7100, 7]
type = HitBy
trigger1 = 1
value = SCA,NA,SA,HA,NP,SP,HP
time = -1

[State 7210, 8]
type = ParentVarSet
trigger1 = !Time && RoundState = 2
var(38) = 1

[State 7210, 9]
type = VarSet
trigger1 = 1
fvar(1) = P2BodyDist X 

[State 7210, 10]
type = VarSet
trigger1 = 1
fvar(2) = P2BodyDist Y 

[State 7210, 11]
type = ChangeState
trigger1 = Vel Y > 0 && Pos Y > -Vel Y
value = 7211
;---------------------------------------------------------------------------
;Link Crouch Summon (Throw)
[Statedef 7211]
type    = S
movetype= I
physics = N
velset = 0,0
ctrl = 0
anim = 7211
sprpriority = 3

[State 7211, 1]
type = PosSet
trigger1 = !Time
y = 0

[State 7211, 2]
type = VelAdd
trigger1 = Vel X > 1
x = -.25

[State 7211, 3]
type = VelSet
trigger1 = Vel X <= 1
x = 0

[State 7211, 4]
type = HitOverride
trigger1 = 1
attr = SCA,NA,SA,HA,NP,SP,HP
stateno = 7230
time = -1

[State 7211, 5]
type = HitBy
trigger1 = 1
value = SCA,NA,SA,HA,NP,SP,HP
time = -1

[State 7211, 6]
type = Explod
trigger1 = AnimElem = 3
anim = 7215
ID = 7050
pos = 0,0
postype = p1
facing = 1
vfacing = 1
bindtime = 1
removetime = -2
scale = const(size.xscale),const(size.yscale)
sprpriority = 2
ownpal = 1
removeongethit = 1

[State 7211, 7]
type = Helper
trigger1 = AnimElem = 5 
name = "Boomerang"
ID = 7050
stateno = 7215
pos = ceil(36*const(size.xscale)),ceil(-40*const(size.yscale))
postype = p1    ;p2,front,back,left,right
facing = 1
keyctrl = 0
ownpal = 1
size.xscale = const(size.xscale)
size.yscale = const(size.yscale)

[State 7211, 8]
type = ParentVarSet
trigger1 = AnimElem = 5
var(39) = 1

[State 7211, 9]
type = VarAdd
trigger1 = AnimElem = 5
var(11) = 1

[State 7211, 10]
type = VarSet
trigger1 = 1
fvar(1) = P2BodyDist X 

[State 7211, 11]
type = VarSet
trigger1 = 1
fvar(2) = P2BodyDist Y 

[State 7211, 12]
type = ChangeState
trigger1 = (NumHelper(7050) = 0) && (Time > 33)
value = 7220
;---------------------------------------------------------------------------
;Boomerang
[Statedef 7215]
type    = S
movetype= A
physics = N
velset = 7.4*const(size.xscale),0
ctrl = 0
anim = 7216
sprpriority = 3

[State 7215, 1]
type = VelSet
trigger1 = Time = 22 && Vel X > 0
x = 3.71*const(size.xscale)

[State 7215, 2]
type = HitDef
trigger1 = root,var(5) < 10 && !Time
attr = S,NA
hitflag = MAF
guardflag = MA
animtype = Medium
priority = 4,Hit
damage = ceil(35*root,Fvar(21)),8
pausetime = 1,1
sparkno = S6000
guard.sparkno = -1
sparkxy = -9,0
hitsound = S5,0
guardsound = S6,0
ground.type = High
ground.slidetime = 10
ground.hittime = 40
guard.hittime = 28
ground.velocity = -3*const(size.xscale)
ground.cornerpush.veloff = 0
air.type = High
air.hittime = 100
air.velocity = -2.9, -2
fall = 1
fall.recover = 0
id = 7201
chainID = -1
nochainID = -1
hitonce = 0
kill = 1
guard.kill = 1
fall.kill = 1
numhits = 1

[State 7025, 3]
type = Null
triggerall = NumTarget && MoveHit && HitPauseTime = 1
trigger1 = root,Cond(FVar(20) > .3, FVar(20) := FVar(20) - .2,0) || root,Cond(FVar(21) > .3, FVar(21) := FVar(21) - .2,0)
ignorehitpause = 1
persistent = 0

[State 7215, 4]
type = VelSet
triggerall = Vel X > 0
trigger1 = Time = 30
trigger2 = MoveContact = 1
trigger3 = parent,StateNo = [7220,7240]
x = -3.71*const(size.xscale)
ignorehitpause = 1

[State 7215, 5]
type = VarSet
triggerall = MoveHit
trigger1 = HitPauseTime = 1
var(1) = 1
ignorehitpause = 1

[State 7215, 5]
type = VarSet
triggerall = MoveHit
trigger1 = HitPauseTime != 1
var(1) = 0
ignorehitpause = 1

[State 7215, 6]
type = PlaySnd
trigger1 = !(GameTime % 9)
value = S7211,0
ignorehitpause = 1

[State 7215, 7]
type = TargetState
triggerall = NumTarget && MoveHit
trigger1 = !(target,Time)
value = 7218
ignorehitpause = 1

[State 7215, 8]
type = ChangeState
trigger1 = MoveHit
value = 7216

[State 7215, 9]
type = ChangeState
trigger1 = BackEdgeDist < -30
trigger2 = (ParentDist X > -30 && ParentDist X < 0) 
value = 7217

;---------------------------------------------------------------------------
;Boomerang
[Statedef 7216]
type    = S
movetype= A
physics = N
velset = -3.71*const(size.xscale),0
ctrl = 0
sprpriority = 3

[State 7216, 1]
type = PlaySnd
trigger1 = !(GameTime % 9)
value = S7211,0
ignorehitpause = 1

[State 7216, 2]
type = TargetBind
trigger1 = 1 
time = -1
pos = 0,(target,Pos Y)-Pos Y

[State 0, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA
time = 1

[State 7216, 3]
type = TargetDrop
triggerall = NumTarget
trigger1 = target,StateNo = [5000,5999]
excludeID = -1
ignorehitpause = 1

[State 7216, 4]
type = ChangeState
trigger1 = BackEdgeDist < -30
trigger2 = (ParentDist X = [-30*const(size.xscale),30*const(size.xscale)])
;trigger3 = parent,StateNo = [7220,7240]
value = 7217
;---------------------------------------------------------------------------
;Boomerang
[Statedef 7217]
type    = A
movetype= I
physics = N
velset = 0,0
ctrl = 0
anim = 1
sprpriority = 3

[State 7217, 1]
type = TargetState
triggerall = NumTarget
trigger1 = !Time
value = 7219 
ID = -1

[State 7217, 2]
type = TargetDrop
triggerall = NumTarget
trigger1 = target,StateNo = [5000,5999]
excludeID = -1

[State 7217, 3]
type = ChangeState
triggerall = !NumTarget
trigger1 = Time = 25
trigger2 = parent,StateNo = [7220,7240]
value = 7063
;---------------------------------------------------------------------------
;Boomerang
[Statedef 7218]
type = A
movetype= H
physics = N
velset = 0,0
ctrl = 0
sprpriority = -3

[State 7218, 1]
type = ChangeAnim
trigger1 = !Time
value = 5002
;---------------------------------------------------------------------------
;Boomerang
[Statedef 7219]
type = A
movetype= H
physics = N
velset = 3.4,-2
ctrl = 0
sprpriority = -3

[State 0, VelSet]
type = VelSet
trigger1 = 1
x = 3.4
y = -2

[State 7219, 1]
type = SelfState
trigger1 = !Time
value = 5050
;---------------------------------------------------------------------------
;Link Leave
[Statedef 7220]
type    = S
movetype= I
physics = N
velset = -5.04,0
ctrl = 0
anim = 7220
sprpriority = 3

[State 7220, 1]
type = ScreenBound
trigger1 = 1
value = 0

[State 7220, 2]
type = PlayerPush
trigger1 = 1
value = 0

[State 7220, 3]
type = PlaySnd
trigger1 = (AnimElem = 1 || AnimElem = 5) || AnimTime = 0
value = S7200,0

[State 7220, 4]
type = ChangeState
trigger1 = BackEdgeDist < -30
value = 7300
;---------------------------------------------------------------------------
; HITA_UP (initial going up)
[Statedef 7230]
type    = U
movetype= H
physics = N
ctrl = 0
anim = 7230
velset = -2.78*const(size.xscale),-6*const(size.yscale)
sprpriority = 3

[State 7230, 1]
type = VelAdd
trigger1 = 1
y = .75*const(size.yscale)

[State 7230, 2]
type = VelSet
trigger1 = Vel Y > 0 && Pos Y > -Vel Y
y = 0

[State 7230, 3]
type = PosSet
trigger1 = Vel Y > 0 && Pos Y > -Vel Y
y = 0

[State 7230, 4]
type = PlaySnd
trigger1 = !Time
value = S7230,0

[State 7230, 5]
type = ParentVarAdd
trigger1 = !Time 
var(6) =  -100
ignorehitpause = 1

[State 7230, 6]
type = ChangeState
trigger1 = root,Var(6) = 0
value = 7240

[State 7230, 7]
type = ChangeState
trigger1 = Time = 30 
value = 7231
;---------------------------------------------------------------------------
; HIT_LAND
[Statedef 7231]
type    = A
movetype= H
physics = N
velset = 0,0
ctrl = 0
anim = 7231
sprpriority = 3

[State 7231, 1]
type = AssertSpecial
trigger1 = Time % 2 = 0 && NumHelper(7050)
flag = invisible

[State 7131, 2]
type = ChangeState
trigger1 = Time >= 50 && NumHelper(7050) = 0
value = 7220
;---------------------------------------------------------------------------
;Link Dead
[Statedef 7240]
type    = U
movetype= H
physics = N
ctrl = 0
anim = 7240
velset = 0,0
sprpriority = 3

[State 7240, 1]
type = PlaySnd
trigger1 = AnimElem = 2
value = S7240,0

[State 7240, 2]
type = PlaySnd
trigger1 = AnimElem = 19
value = S7240,1

[State 7240, 3]
type = ChangeState
trigger1 = !AnimTime
value = 7300
;---------------------------------------------------------------------------
;Helper Gone
[Statedef 7300]
type    = U
movetype= H
physics = N
ctrl = 0
anim = 1
velset = 0,0
sprpriority = 3

[State 7300, 1]
type = ParentVarSet
trigger1 = Var(11) = Var(10)
var(39) = 0
ignorehitpause = 1

[State 7300, 2]
type = ParentVarSet
trigger1 = !Time
var(38) = 0
ignorehitpause = 1

[State 7300, 3]
type = DestroySelf
triggerall = !(root,Var(38)) && !(root,Var(39))
trigger1 = !NumTarget && Anim = 1
trigger2 = NumTarget && Anim = 1
trigger2 = target,StateType = L
